package edu.uwlax.cs.oayonlinestore.client.gui;

import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;

public class Design extends FlowPanel {

	private static final String STYLE_BOTTOM = "DesignBottom";

	private static final String STYLE_BOTTOMLEFT = "DesignBottomLeft";

	private static final String STYLE_BOTTOMRIGHT = "DesignBottomRight";

	private static final String STYLE_CONTENT = "DesignContent";

	private static final String STYLE_FRAME = "DesignFrame";

	private static final String STYLE_LEFT = "DesignLeft";

	private static final String STYLE_LOGIN = "DesignLogin";

	private static final String STYLE_LOGO = "DesignLogo";

	private static final String STYLE_MENU = "DesignMenu";

	private static final String STYLE_RIGHT = "DesignRight";

	private static final String STYLE_TOP = "DesignTop";

	private static final String STYLE_TOPRIGHT = "DesignTopRight";

	private SimplePanel content;

	private SimplePanel login;

	private SimplePanel menu;

	public Design() {
		super();
		setStyleName(STYLE_FRAME);

		add(createPanel(STYLE_LOGO));
		add(createPanel(STYLE_TOPRIGHT));
		add(createTop());

		add(createContentPanel());

		add(createPanel(STYLE_BOTTOMLEFT));
		add(createPanel(STYLE_BOTTOMRIGHT));
		add(createPanel(STYLE_BOTTOM));
	}

	private Widget createContentPanel() {
		SimplePanel left = createPanel(STYLE_LEFT);
		SimplePanel right = createPanel(STYLE_RIGHT);
		content = createPanel(STYLE_CONTENT);
		left.setWidget(right);
		right.setWidget(content);
		return left;
	}

	private SimplePanel createPanel(String style) {
		SimplePanel p = new SimplePanel();
		p.setStyleName(style);
		return p;
	}

	private Widget createTop() {
		FlowPanel top = new FlowPanel();
		top.setStyleName(STYLE_TOP);
		top.add(login = createPanel(STYLE_LOGIN));
		top.add(new SimplePanel());
		top.add(menu = createPanel(STYLE_MENU));
		return top;
	}

	public void setContent(Widget content) {
		this.content.setWidget(content);
	}

	public void setLogin(Widget login) {
		this.login.setWidget(login);
	}

	public void setMenu(Widget menu) {
		this.menu.setWidget(menu);
	}

}
